import 'dotenv/config';
import type { VercelRequest, VercelResponse } from '@vercel/node';
import { handleExceptionRequireLogin } from '../../util/exception';
import { successWithData } from '../../util/result';
import { getUserInfo } from '../../service/user/UserService';

/**
 * 获取用户自己信息接口
 */
export default async (_req: VercelRequest, _res: VercelResponse) => {
   return await handleExceptionRequireLogin(_req,_res,async (request,response,username) => {
      return response.status(200).json(successWithData(await getUserInfo(username)));
   })

}